<!doctype html>



  


<html class="theme-next pisces use-motion">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />












  
  
  <link href="/vendors/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/vendors/font-awesome/css/font-awesome.min.css?v=4.4.0" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.0.1" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Android,IPC," />





  <link rel="alternate" href="/atom.xml" title="GrantonZhuang's Blog" type="application/atom+xml" />




  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.0.1" />






<meta name="description" content="大纲最近开始在 Android 开发艺术探索 这本书上学习 Android 上进程间通信的实现，根据学习的情况，写一个系列的学习笔记，总共分为如下几个部分

使用 AIDL 进行进程间通信入门
使用 AIDL 进行进程间通信进阶
使用 ContentProvider 进行进程间通信
使用 Socket 进行进程间通信
其他知识点补充和踩坑记录">
<meta property="og:type" content="article">
<meta property="og:title" content="Android IPC 学习笔记 1 使用 AIDL 进行进程间通信入门">
<meta property="og:url" content="https://grantonzhuang.github.io/2016/06/10/AndroidIPC学习笔记1/index.html">
<meta property="og:site_name" content="GrantonZhuang's Blog">
<meta property="og:description" content="大纲最近开始在 Android 开发艺术探索 这本书上学习 Android 上进程间通信的实现，根据学习的情况，写一个系列的学习笔记，总共分为如下几个部分

使用 AIDL 进行进程间通信入门
使用 AIDL 进行进程间通信进阶
使用 ContentProvider 进行进程间通信
使用 Socket 进行进程间通信
其他知识点补充和踩坑记录">
<meta property="og:updated_time" content="2016-07-29T13:56:02.584Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Android IPC 学习笔记 1 使用 AIDL 进行进程间通信入门">
<meta name="twitter:description" content="大纲最近开始在 Android 开发艺术探索 这本书上学习 Android 上进程间通信的实现，根据学习的情况，写一个系列的学习笔记，总共分为如下几个部分

使用 AIDL 进行进程间通信入门
使用 AIDL 进行进程间通信进阶
使用 ContentProvider 进行进程间通信
使用 Socket 进行进程间通信
其他知识点补充和踩坑记录">



<script type="text/javascript" id="hexo.configuration">
  var NexT = window.NexT || {};
  var CONFIG = {
    scheme: 'Pisces',
    sidebar: {"position":"left","display":"post"},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: 0,
      author: '博主'
    }
  };
</script>




  <link rel="canonical" href="https://grantonzhuang.github.io/2016/06/10/AndroidIPC学习笔记1/"/>

  <title> Android IPC 学习笔记 1 使用 AIDL 进行进程间通信入门 | GrantonZhuang's Blog </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  










  
  
    
  

  <div class="container one-collumn sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-meta ">
  

  <div class="custom-logo-site-title">
    <a href="/"  class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <span class="site-title">GrantonZhuang's Blog</span>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>
  <p class="site-subtitle"></p>
</div>

<div class="site-nav-toggle">
  <button>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
  </button>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/index.html" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/index.html" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/index.html" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      

      
    </ul>
  

  
</nav>

 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  
  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                Android IPC 学习笔记 1 使用 AIDL 进行进程间通信入门
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            <span class="post-meta-item-icon">
              <i class="fa fa-calendar-o"></i>
            </span>
            <span class="post-meta-item-text">发表于</span>
            <time itemprop="dateCreated" datetime="2016-06-10T21:43:55+08:00" content="2016-06-10">
              2016-06-10
            </time>
          </span>

          

          
            
          

          

          
          

          
        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="大纲"><a href="#大纲" class="headerlink" title="大纲"></a>大纲</h2><p>最近开始在 <code>Android 开发艺术探索</code> 这本书上学习 Android 上进程间通信的实现，根据学习的情况，写一个系列的学习笔记，总共分为如下几个部分</p>
<ul>
<li>使用 AIDL 进行进程间通信入门</li>
<li>使用 AIDL 进行进程间通信进阶</li>
<li>使用 ContentProvider 进行进程间通信</li>
<li>使用 Socket 进行进程间通信</li>
<li>其他知识点补充和踩坑记录</li>
</ul>
<a id="more"></a>
<h3 id="AIDL-概览"><a href="#AIDL-概览" class="headerlink" title="AIDL 概览"></a>AIDL 概览</h3><p>AIDL 的全称是 <code>Android Interface Definition Language</code> Android 接口定义语言。</p>
<p>在编译的过程中，开发工具比如 Android Studio 会根据 AIDL 文件的声明来自动生成对应的接口，使用 Android Studio 建立一个 AIDL 文件。</p>
<p><code>DemoInterface.aidl</code></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div></pre></td><td class="code"><pre><div class="line">package com.granton.androidipclearn.aidl;</div><div class="line"></div><div class="line">// Declare any non-default types here with import statements</div><div class="line"></div><div class="line">interface DemoInterface &#123;</div><div class="line">    /**</div><div class="line">     * Demonstrates some basic types that you can use as parameters</div><div class="line">     * and return values in AIDL.</div><div class="line">     */</div><div class="line">    void basicTypes(int anInt, long aLong, boolean aBoolean, float aFloat,</div><div class="line">            double aDouble, String aString);</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<p>在 <code>src/main</code> 目录下可以看到如下结构</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div></pre></td><td class="code"><pre><div class="line">➜  main git:(master) ✗ tree</div><div class="line">.</div><div class="line">├── aidl</div><div class="line">│   └── com</div><div class="line">│       └── granton</div><div class="line">│           └── androidipclearn</div><div class="line">│               └── aidl</div><div class="line">│                   └── DemoInterface.aidl</div><div class="line">├── AndroidManifest.xml</div><div class="line">├── java</div><div class="line">│   └── com</div><div class="line">│       └── granton</div><div class="line">│           └── androidipclearn</div><div class="line">│               └── MainActivity.java</div></pre></td></tr></table></figure>
<h3 id="AIDL-的语法细则-支持的数据类型"><a href="#AIDL-的语法细则-支持的数据类型" class="headerlink" title="AIDL 的语法细则 支持的数据类型"></a>AIDL 的语法细则 支持的数据类型</h3><blockquote>
<p>从 basicTypes 方法的注释里可以明白，AIDL 声明的接口，允许将 int long boolean float double String 这六种类型的变量作为参数以及返回值，实际上还一些没有提到的数据类型</p>
</blockquote>
<ul>
<li>所有基本数据类型，以及 CharSequence</li>
<li>任何实现了 Parcelable 接口的类</li>
<li>ArrayList&lt; T supported by AIDL &gt;</li>
<li>HashMap&lt; T supported by AIDL, T supported by AIDL &gt;</li>
<li>AIDL, AIDL 接口本身也在 AIDL 文件中可以被使用</li>
</ul>
<h3 id="AIDL-的语法细则-导包"><a href="#AIDL-的语法细则-导包" class="headerlink" title="AIDL 的语法细则 导包"></a>AIDL 的语法细则 导包</h3><p>如果在 AIDL 中使用了某个实现 Parcelable 接口的 Model，我们假设 Model 的定义如下：</p>
<p><code>Model.java</code></p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">package</span> com.exp.model;</div><div class="line"></div><div class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Model</span> <span class="keyword">implements</span> <span class="title">Parcelable</span> </span>&#123;</div><div class="line">	<span class="comment">// ...</span></div><div class="line">&#125;</div></pre></td></tr></table></figure>
<p>那么需要在 AIDL 的包里建立相同的包名和文件名</p>
<p><code>Model.aidl</code></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">package com.exp.model;</div><div class="line">parcelable Model;</div></pre></td></tr></table></figure>
<p>同样，在任何引用到这个 AIDL 文件的 AIDL 文件里，都需要<strong>显式</strong>地进行导包，即使引用方和被引用方在同一个包里</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">package com.exp.model</div><div class="line"></div><div class="line">import com.exp.model.Model;</div><div class="line">interface XXXInterface &#123;</div><div class="line">	// some method declare</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<h3 id="生成的代码"><a href="#生成的代码" class="headerlink" title="生成的代码"></a>生成的代码</h3><p>在 <code>moduleName/build/generated/source/aidl/debug/com/packageName/</code> 中我们可以看到 Android Studio 为我们生成的接口代码，结构如下：</p>
<ul>
<li>DemoInterface<ul>
<li>接口方法 basicTypes()</li>
<li>抽象类 Stub 继承自 Binder，实现了 DemoInterface 接口<ul>
<li>内部静态类 Proxy 实现了 DemoInterface 接口</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>Stub 的结构如下</p>
<ul>
<li>Stub extends Binder<ul>
<li>静态常量 <code>DESCRIPTOR</code> 一般为类名</li>
<li><code>asInterface()</code> 将服务端的 Binder 对象转换为客户端需要的 AIDL 接口的实例，如果客户端和服务端在同一个进程，返回服务端的 Stub 对象本身，否则返回 Proxy 对象</li>
<li><code>asBinder()</code> 返回 Binder 对象本身</li>
<li><code>onTransact()</code> 方法，这个方法的参数如下，看到这个方法，终于有点 server and client 的味道了<ul>
<li><code>int code</code> 表示需要调用哪个方法，IDE 会为每一个接口方法都生成一个整形的标识符</li>
<li><code>Parcel data</code> 方法的参数从 data 中读出</li>
<li><code>Parcel reply</code> 方法的返回值写入 reply 中</li>
<li><code>int flags</code> 没发现是做啥的</li>
<li>返回值：返回 true 客户端请求成功，否则返回 false，从安全的角度来讲，可以用来做权限验证，对于未知来源的请求，返回 false 即可拦截。</li>
</ul>
</li>
</ul>
</li>
</ul>
<h3 id="实例"><a href="#实例" class="headerlink" title="实例"></a>实例</h3><p>首先是远程 Service 的代码</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">RemoteService</span> <span class="keyword">extends</span> <span class="title">Service</span> </span>&#123;</div><div class="line"></div><div class="line">    String TAG = getClass().getSimpleName();</div><div class="line"></div><div class="line">	<span class="comment">// 声明 binder 成员变量，这个变量处理所有来自客户端的请求</span></div><div class="line">    <span class="keyword">private</span> DemoInterface.Stub binder = <span class="keyword">new</span> DemoInterface.Stub() &#123;</div><div class="line">        <span class="meta">@Override</span></div><div class="line">        <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">basicTypes</span><span class="params">(<span class="keyword">int</span> anInt, <span class="keyword">long</span> aLong, <span class="keyword">boolean</span> aBoolean, <span class="keyword">float</span> aFloat, <span class="keyword">double</span> aDouble, String aString)</span> <span class="keyword">throws</span> RemoteException </span>&#123;</div><div class="line">            Log.i(TAG, <span class="string">"anInt = "</span> + anInt);</div><div class="line">            Log.i(TAG, <span class="string">"aLong = "</span> + aLong);</div><div class="line">            Log.i(TAG, <span class="string">"aBoolean = "</span> + aBoolean);</div><div class="line">        &#125;</div><div class="line">    &#125;;</div><div class="line"></div><div class="line">    <span class="meta">@Nullable</span></div><div class="line">    <span class="meta">@Override</span></div><div class="line">    <span class="function"><span class="keyword">public</span> IBinder <span class="title">onBind</span><span class="params">(Intent intent)</span> </span>&#123;</div><div class="line">        <span class="comment">// 在 onBind 回调方法中，也就是服务端与客户端绑定的时候，返回 binder 对象</span></div><div class="line">        <span class="keyword">return</span> binder;</div><div class="line">    &#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<p>客户端代码</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div></pre></td><td class="code"><pre><div class="line"><span class="comment">// 新建一个 ServiceConnection 对象，用来处理服务连接和服务断开时候的事件</span></div><div class="line"><span class="keyword">private</span> ServiceConnection serviceConnection = <span class="keyword">new</span> ServiceConnection() &#123;</div><div class="line">    <span class="meta">@Override</span></div><div class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">onServiceConnected</span><span class="params">(ComponentName name, IBinder service)</span> </span>&#123;</div><div class="line">    	<span class="comment">// 转化为服务端返回的 binder 为接口实例，调用业务需要的接口方法</span></div><div class="line">        DemoInterface demoInterface = DemoInterface.Stub.asInterface(service);</div><div class="line">        <span class="keyword">try</span> &#123;</div><div class="line">            demoInterface.basicTypes(<span class="number">1</span>, <span class="number">1l</span>, <span class="keyword">true</span>, <span class="number">0f</span>, <span class="number">2.0</span>, <span class="string">"123"</span>);</div><div class="line">        &#125; <span class="keyword">catch</span> (RemoteException e) &#123;</div><div class="line">            e.printStackTrace();</div><div class="line">        &#125;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    <span class="meta">@Override</span></div><div class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">onServiceDisconnected</span><span class="params">(ComponentName name)</span> </span>&#123;</div><div class="line">        <span class="comment">// <span class="doctag">TODO:</span> 当连接断开的时候作出处理</span></div><div class="line">    &#125;</div><div class="line">&#125;;</div><div class="line"></div><div class="line"><span class="comment">// 在需要连接服务的地方调用 bindService 方法</span></div><div class="line"><span class="meta">@Override</span></div><div class="line"><span class="function"><span class="keyword">protected</span> <span class="keyword">void</span> <span class="title">onResume</span><span class="params">()</span> </span>&#123;</div><div class="line">    <span class="keyword">super</span>.onResume();</div><div class="line">    Intent intent = <span class="keyword">new</span> Intent(<span class="keyword">this</span>, RemoteService.class);</div><div class="line">    bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE);</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<p>运行结果看 log 输出，由于声明了服务在 remote 进程，所以在查看 log 的时候，需要切换原来的进程到 remote 进程。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">06-12 10:38:27.522 2161-2173/? I/RemoteService: anInt = 1</div><div class="line">06-12 10:38:27.522 2161-2173/? I/RemoteService: aLong = 1</div><div class="line">06-12 10:38:27.522 2161-2173/? I/RemoteService: aBoolean = true</div></pre></td></tr></table></figure>
      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Android/" rel="tag">#Android</a>
          
            <a href="/tags/IPC/" rel="tag">#IPC</a>
          
        </div>
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2016/06/05/Android 动态加载 so 库学习笔记/" rel="next" title="Android 动态加载 so 库学习笔记">
                <i class="fa fa-chevron-left"></i> Android 动态加载 so 库学习笔记
              </a>
            
          </div>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2016/06/14/AndroidIPC学习笔记2/" rel="prev" title="Android IPC 学习笔记 2 使用 AIDL 进行进程间通信进阶">
                Android IPC 学习笔记 2 使用 AIDL 进行进程间通信进阶 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel ">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="http://ww1.sinaimg.cn/mw690/6e8939a6gw1f3g1u1mc6lj20hs0hsmxf.jpg"
               alt="Granton Zhuang" />
          <p class="site-author-name" itemprop="name">Granton Zhuang</p>
          <p class="site-description motion-element" itemprop="description"></p>
        </div>
        <nav class="site-state motion-element">
          <div class="site-state-item site-state-posts">
            <a href="/archives/index.html">
              <span class="site-state-item-count">26</span>
              <span class="site-state-item-name">日志</span>
            </a>
          </div>

          

          
            <div class="site-state-item site-state-tags">
              <a href="/tags/index.html">
                <span class="site-state-item-count">11</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        
          <div class="feed-link motion-element">
            <a href="/atom.xml" rel="alternate">
              <i class="fa fa-rss"></i>
              RSS
            </a>
          </div>
        

        <div class="links-of-author motion-element">
          
        </div>

        
        

        
        

      </section>

      
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">
            
              
            
            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#大纲"><span class="nav-number">1.</span> <span class="nav-text">大纲</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#AIDL-概览"><span class="nav-number">1.1.</span> <span class="nav-text">AIDL 概览</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#AIDL-的语法细则-支持的数据类型"><span class="nav-number">1.2.</span> <span class="nav-text">AIDL 的语法细则 支持的数据类型</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#AIDL-的语法细则-导包"><span class="nav-number">1.3.</span> <span class="nav-text">AIDL 的语法细则 导包</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#生成的代码"><span class="nav-number">1.4.</span> <span class="nav-text">生成的代码</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#实例"><span class="nav-number">1.5.</span> <span class="nav-text">实例</span></a></li></ol></li></ol></div>
            
          </div>
        </section>
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2016</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Granton Zhuang</span>
</div>

<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Pisces
  </a>
</div>

        

        
      </div>
    </footer>

    <div class="back-to-top">
      <i class="fa fa-arrow-up"></i>
    </div>
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  



  
  <script type="text/javascript" src="/vendors/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/vendors/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/vendors/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/vendors/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/vendors/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/vendors/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.0.1"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.0.1"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.0.1"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.0.1"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.0.1"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.0.1"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.0.1"></script>



  



  




  
  

  

  

  

</body>
</html>
